//
//  HomeViewController.swift
//  LPSina
//
//  Created by apple on 16/3/20.
//  Copyright © 2016年 apple. All rights reserved.
//

import UIKit

class HomeViewController: BaseViewController {

    // MARK:- 系统回调函数-----------------------------
    override func viewDidLoad() {
        super.viewDidLoad()
        
        //添加动画
        setupRotationView()
        
        setupNavigationItem()

    }
    
    // MARK:- 自定义的方法-----------------------------
    func setupNavigationItem() {
    
        // 初始化左边的item
        navigationItem.leftBarButtonItem = UIBarButtonItem(customView: UIButton(imageName: "navigationbar_friendattention", target: self , action: "leftBtnClick"))
        // 初始化右边的item
        navigationItem.rightBarButtonItem = UIBarButtonItem(customView: UIButton(imageName: "navigationbar_pop", target: self , action: "rightBtnClick"))
        
        // 初始化中间的item
        let titleBtn = TitleButton()
        titleBtn.addTarget(self, action: "titleBtnClick:", forControlEvents: .TouchUpInside)
        navigationItem.titleView = titleBtn
        
    }
    
    // 点击事件监听
    @objc private func leftBtnClick() {
        print("点击了左边的按钮")
    }
    
    @objc private func rightBtnClick() {
        print("点击了右边的按钮")
    }
    
    @objc private func titleBtnClick(titleBtn: TitleButton) {
        titleBtn.selected = !titleBtn.selected
    }


}
